package edu.sctu.java.decorator;

public class EncryptionDataSource extends DataSourceDecorator {

    public EncryptionDataSource(DataSource dataSource) {
        super(dataSource);
    }

    @Override
    public String read() {
        return decode(super.read());
    }

    @Override
    public void write(String data) {
        super.write(encode(data));
    }

    private String encode(String data) {

        return "encrypted, " + data;
    }

    private String decode(String data) {
        return "decoded, " + data;
    }
}
